<h1>Affiliate Commission Details for <?php echo amDate($date) ?></h1>

<?php if ($commissions):?>
<h2>Commissions</h2>
<div class="grid-container">
<table class="grid">
<tr>
    <th><?php __e('Amount') ?></th>
    <th><?php __e('Tier') ?></th>
    <th><?php __e('Record Type') ?></th>
    <th><?php __e('Payment#/Receipt#') ?></th>
    <th><?php __e('User') ?></th>
    <th><?php __e('Product') ?></th>
</tr>
<?php 
foreach ($commissions as $c): 
/* @var $c Aff_Commission */    
    $p = $c->getPayment();
    if ($p) $invoice = $p->getInvoice();
    if ($p) $user = Am_Di::getInstance()->userTable->load($p->user_id);
    
    printf("<tr%s><td>%.2f</td><td>%d</td><td>%s</td><td>%s/%s</td>
            <td>%s</td><td>#%d</td>
            </tr>\n",
            $i++%2 ? ' class="odd"' : '',
            $c->amount,
            $c->tier,
            $c->record_type,
            $c->invoice_payment_id,
            $c->receipt_id,
            $user ? sprintf('%s : "%s" &lt;%s&gt;', 
                $this->escape($user->login),
                $this->escape($user->name_f . " " . $user->name_l),
                $this->escape($user->email)): "-",
                $c->product_id
            );
endforeach;
?>
</table>
</div>
<?php endif; ?>


<?php if ($clicks):?>
<h2>Clicks</h2>
<div class="grid-container">
<table class="grid">
<tr>
    <th><?php __e('Time') ?></th>
    <th><?php __e('IP') ?></th>
    <th><?php __e('URL') ?></th>
    <th><?php __e('Referer') ?></th>
</tr>
<?php 
foreach ($clicks as $c): 
    printf("<tr><td>%s</td><td>%s</td>
            <td><a href='%s' target='blank'>%s</a></td>
            <td><a href='%s' target='blank'>%s</a></td>
            </tr>\n",
            amDateTime($c->time),
            $this->escape($c->remote_addr),
            $this->escape($c->url), $this->escape($c->url),
            $this->escape($c->referrer), $this->escape($c->referrer)
            );
endforeach;
?>
</table>
</div>
<?php endif; ?>
